<%@page import="qldc.pm.qtht.dmdc.constants.DanTocEnum"%>
<%@page import="com.liferay.portal.kernel.language.LanguageUtil"%>
<%@page import="qldc.pm.qtht.dmdc.enumclass.EnumQuocTich"%>
<%@page import="qldc.pm.qtht.dmdc.enumclass.EnumGioiTinh"%>
<%@page import="qldc.pm.qtht.dmdc.service.DanTocLocalServiceUtil"%>
<%@page import="qldc.pm.qtht.dmdc.model.DanToc"%>
<%@page import="qldc.pm.csdl.cd90.model.CMND"%>
<%@page import="qldc.pm.csdl.cd90.service.CMNDLocalServiceUtil"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.Date"%>
<%@page import="com.liferay.portal.kernel.util.Validator"%>
<%@page import="qldc.pm.tienan.service.YeuCauTrichLucLocalServiceUtil"%>
<%@page import="qldc.pm.tienan.model.YeuCauTrichLuc"%>
<%@page import="com.liferay.portal.kernel.util.StringPool"%>
<%@page import="qldc.pm.qtht.dmdc.service.TinhLocalServiceUtil"%>
<%@page import="qldc.pm.qtht.dmdc.model.Tinh"%>
<%@page import="java.util.List"%>
<%@page import="com.liferay.portal.kernel.util.Constants"%>
<%@include file="../../init.jsp"%>

<portlet:resourceURL var="layMaYCTL" id="layMaYCTL">
</portlet:resourceURL>

<%
String pathThemeImages = themeDisplay.getPathThemeImages();
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");

String redirect = ParamUtil.getString(request, "redirect");

long yeuCauTrichLucId = ParamUtil.getLong(request, "yeuCauTrichLucId");
String mode = ParamUtil.getString(request, "mode");
String soDinhDanhCaNhan = "";
YeuCauTrichLuc yeuCauTrichLuc = YeuCauTrichLucLocalServiceUtil.findByYeuCauTrichLucId(yeuCauTrichLucId);
String hoVaTenGoiKhac = "";
String kinhGui = "";
String hoVaTenCha = "";
String hoVaTenMe = "";
String hoTenVoHoacChong = "";
String hoVaTenNguoiYeuCauTrichLuc = "";

String soCMNDDoiTuongTrichLuc = "";
Date ngayCapSoCMNDDoiTuongTrichLuc = null;
String noiCapSoCMNDDoiTuongTrichLuc = "";

String soHoChieuDoiTuongTrichLuc = "";
Date ngayCapSoHoChieuDoiTuongTrichLuc = null;
String noiCapSoHoChieuDoiTuongTrichLuc = "";

String soDinhDanhCaNhanDoiTuongTrichLuc = "";
String hoVaTenDoiTuongTrichLuc = "";
Date ngaySinhDoiTuongTrichLuc = null;
String noiSinh = "";
long noiSinhTinhId=0;
long noiSinhQuanHuyenId  =0;
long noiSinhPhuongXaId =0;
long noiThuongTruDoiTuongTrichLucTinhId = 0L;
long noiThuongTruDoiTuongTrichLucQuanHuyenId = 0L;
long noiThuongTruDoiTuongTrichLucPhuongXaId = 0L;
String noiThuongTruDoiTuongTrichLucDiaChi = "";
long noiTamTruDoiTuongTrichLucTinhId = 0L;
long noiTamTruDoiTuongTrichLucQuanHuyenId = 0L;
long noiTamTruDoiTuongTrichLucPhuongXaId = 0L;
String noiTamTruDoiTuongTrichLucDiaChi = "";
String soSoHoKhauDoiTuongTrichLuc = "";
Date ngayDeNghiTraTrichLuc = null;
Date ngayLapTrichLuc = null;
String coQuanYeuCau = "";
String noiDungTrichLuc = "";
String chuThich = "";
String maYeuCauTrichLuc="";

String quocTich = "";
long danTocId = 0;
int gioiTinh = 0;
if(Validator.isNotNull(yeuCauTrichLuc)) {
	kinhGui = yeuCauTrichLuc.getKinhGui();
	quocTich = yeuCauTrichLuc.getQuocTich();
	danTocId = yeuCauTrichLuc.getDanTocId();
	gioiTinh = yeuCauTrichLuc.getGioiTinh();
	maYeuCauTrichLuc = yeuCauTrichLuc.getMaYeuCauTrichLuc();
	hoVaTenNguoiYeuCauTrichLuc = yeuCauTrichLuc.getHoVaTenNguoiYeuCauTrichLuc();
	noiSinh = yeuCauTrichLuc.getNoiSinh();
	soCMNDDoiTuongTrichLuc = yeuCauTrichLuc.getSoCMNDDoiTuongTrichLuc();
	ngayCapSoCMNDDoiTuongTrichLuc = yeuCauTrichLuc.getNgayCapCMNDDoiTuongTrichLuc();
	noiCapSoCMNDDoiTuongTrichLuc = yeuCauTrichLuc.getNoiCapCMNDDoiTuongTrichLuc();
	noiSinhTinhId = yeuCauTrichLuc.getNoiSinhTinhId();
	noiSinhPhuongXaId = yeuCauTrichLuc.getNoiSinhPhuongXaId();
	noiSinhQuanHuyenId = yeuCauTrichLuc.getNoiSinhQuanHuyenId();
	
	soHoChieuDoiTuongTrichLuc = yeuCauTrichLuc.getSoHoChieuDoiTuongTrichLuc();
	ngayCapSoHoChieuDoiTuongTrichLuc = yeuCauTrichLuc.getNgayCapHoChieuDoiTuongTrichLuc();
	noiCapSoHoChieuDoiTuongTrichLuc = yeuCauTrichLuc.getNoiCapHoChieuDoiTuongTrichLuc();
	
	soDinhDanhCaNhanDoiTuongTrichLuc = yeuCauTrichLuc.getSoDinhDanhCaNhanDoiTuongTrichLuc();
	hoVaTenDoiTuongTrichLuc = yeuCauTrichLuc.getHoVaTenDoiTuongTrichLuc();
	ngaySinhDoiTuongTrichLuc = yeuCauTrichLuc.getNgaySinhDoiTuongTrichLuc();
	noiThuongTruDoiTuongTrichLucTinhId = yeuCauTrichLuc.getNoiThuongTruDoiTuongTrichLucTinhId();
	noiThuongTruDoiTuongTrichLucQuanHuyenId = yeuCauTrichLuc.getNoiThuongTruDoiTuongTrichLucQuanHuyenId();
	noiThuongTruDoiTuongTrichLucPhuongXaId = yeuCauTrichLuc.getNoiThuongTruDoiTuongTrichLucPhuongXaId();
	noiThuongTruDoiTuongTrichLucDiaChi = yeuCauTrichLuc.getNoiThuongTruDoiTuongTrichLucDiaChi();
	soSoHoKhauDoiTuongTrichLuc = yeuCauTrichLuc.getSoSoHoKhauDoiTuongTrichLuc();
	ngayDeNghiTraTrichLuc = yeuCauTrichLuc.getNgayDeNghiTraTrichLuc();
	soDinhDanhCaNhan = yeuCauTrichLuc.getSoDinhDanhCaNhanDoiTuongTrichLuc();
	CMND giayCMND = CMNDLocalServiceUtil.findBySoDinhDanhCaNhan(soDinhDanhCaNhan);
	ngayLapTrichLuc = yeuCauTrichLuc.getNgayLapTrichLuc();
	
	noiDungTrichLuc = yeuCauTrichLuc.getNoiDungTrichLuc();
	chuThich = yeuCauTrichLuc.getChuThich();
	hoVaTenGoiKhac = yeuCauTrichLuc.getHoVaTenGoiKhac();
	hoVaTenCha = yeuCauTrichLuc.getHoVaTenCha();
	hoVaTenMe = yeuCauTrichLuc.getHoVaTenMe();
	hoTenVoHoacChong = yeuCauTrichLuc.getHoTenVoHoacChong();
	noiThuongTruDoiTuongTrichLucTinhId = yeuCauTrichLuc.getNoiThuongTruDoiTuongTrichLucTinhId();
	noiTamTruDoiTuongTrichLucQuanHuyenId = yeuCauTrichLuc.getNoiTamTruDoiTuongTrichLucQuanHuyenId();
	noiTamTruDoiTuongTrichLucPhuongXaId = yeuCauTrichLuc.getNoiTamTruDoiTuongTrichLucPhuongXaId();
	noiTamTruDoiTuongTrichLucDiaChi = yeuCauTrichLuc.getNoiTamTruDoiTuongTrichLucDiaChi();
	coQuanYeuCau = yeuCauTrichLuc.getCoQuanYeuCauTrichLuc();
	ngayLapTrichLuc = yeuCauTrichLuc.getNgayLapTrichLuc();
}

%>

<portlet:actionURL var="capNhatYeuCauTrichLucTienAnActionURL">
	<portlet:param name="mvcPath" value="/html/view.jsp"/>
	<portlet:param name="chonChucNangItem" value="<%=TienAnConstants.QUAN_LY_YEU_CAU_TRICH_LUC %>"/>
	<portlet:param name="<%=TienAnConstants.ACTION_HANDLER_PARAM %>" value="<%=TienAnConstants.QUAN_LY_YEU_CAU_TRICH_LUC %>"/>
	<portlet:param name="<%=Constants.ACTION %>" value="capNhatYeuCauTrichLucTienAn"/>
	<portlet:param name="redirect" value="<%=redirect %>"/>
	<portlet:param name="yeuCauTrichLucId" value="<%=String.valueOf(yeuCauTrichLucId) %>"/>
</portlet:actionURL>

<portlet:resourceURL var="loadQuanHuyen" id="loadQuanHuyen">
	<portlet:param name="tinhIdSelected" value="{0}" />
</portlet:resourceURL>

<portlet:resourceURL var="loadPhuongXa" id="loadPhuongXa">
	<portlet:param name="quanHuyenIdSelected" value="{0}" />
</portlet:resourceURL>

<script type="text/javascript">
$(function() {
	var yeuCauTrichLuc = new  YeuCauTrichLuc();
	/*
	 *
	 */
	 yeuCauTrichLuc.initComponents({
		ngaySinhDoiTuongTrichLuc: "<portlet:namespace/>ngaySinhDoiTuongTrichLuc"
		, ngayDeNghiTraTrichLuc: "<portlet:namespace />ngayDeNghiTraTrichLuc",
		ngayLapTrichLuc: "<portlet:namespace />ngayLapTrichLuc"
		,ngayCapSoCMND: "<portlet:namespace />ngayCapSoCMND",
		ngayCapSoHoChieu: "<portlet:namespace />ngayCapSoHoChieu"
		, calendarIcon : "<%= pathThemeImages %>/common/calendar.png"
	});
	
	 loadQuanHuyen('<portlet:namespace />noiThuongTruDoiTuongTrichLucTinhId', '<portlet:namespace />noiThuongTruDoiTuongTrichLucQuanHuyenId', '<portlet:namespace />noiThuongTruDoiTuongTrichLucPhuongXaId', '<%=loadQuanHuyen.toString()%>','<%=noiThuongTruDoiTuongTrichLucQuanHuyenId %>');
	 loadPhuongXa('<portlet:namespace/>noiThuongTruDoiTuongTrichLucQuanHuyenId', '<portlet:namespace/>noiThuongTruDoiTuongTrichLucPhuongXaId', '<%=loadPhuongXa.toString() %>', '<%=noiThuongTruDoiTuongTrichLucPhuongXaId %>');
	 loadQuanHuyen('<portlet:namespace />noiTamTruDoiTuongTrichLucTinhId', '<portlet:namespace />noiTamTruDoiTuongTrichLucQuanHuyenId', '<portlet:namespace />noiTamTruDoiTuongTrichLucPhuongXaId', '<%=loadQuanHuyen.toString()%>','<%=noiTamTruDoiTuongTrichLucQuanHuyenId %>');
	 loadPhuongXa('<portlet:namespace/>noiTamTruDoiTuongTrichLucQuanHuyenId', '<portlet:namespace/>noiTamTruDoiTuongTrichLucPhuongXaId', '<%=loadPhuongXa.toString() %>', '<%=noiTamTruDoiTuongTrichLucPhuongXaId %>');
	 loadQuanHuyen('<portlet:namespace />noiSinhTinhId', '<portlet:namespace />noiSinhQuanHuyenId', '<portlet:namespace />noiSinhPhuongXaId', '<%=loadQuanHuyen.toString()%>','<%=noiSinhQuanHuyenId %>');
	 loadPhuongXa('<portlet:namespace/>noiSinhQuanHuyenId', '<portlet:namespace/>noiSinhPhuongXaId', '<%=loadPhuongXa.toString() %>', '<%=noiSinhPhuongXaId %>');



});


function layMa() {
	jQuery.ajax({
		url : "<%=layMaYCTL.toString()%>",
		dataType : 'json',
		type : "POST",
		cache : false,
		timeout : 10000,
		async : false,
		success : function(data) {
			$("#<portlet:namespace/>maYeuCauTrichLuc").val(data.maYeuCauTrichLuc);			
		},
		error : function(xhr, textStatus, errorThrown) {
			alert(textStatus);
		}
	});
	
}

function <portlet:namespace/>validationForm(){
	var isOk = true;
	
	var maso = $('#<portlet:namespace/>maYeuCauTrichLuc');
	var tinhNoiThuongTru = $('#<portlet:namespace/>noiThuongTruDoiTuongTrichLucTinhId');
	var quanHuyenNoiThuongTru = $('#<portlet:namespace/>noiThuongTruDoiTuongTrichLucQuanHuyenId');
	var phuongXaNoiThuongTru = $('#<portlet:namespace/>noiThuongTruDoiTuongTrichLucPhuongXaId');
	if (maso.val() == ''){
		showPopupConfirm('<liferay-ui:message key="xin-vui-long-lay-ma-yeu-cau-trich-luc" />',['Ok'],function(index){
			maso.focus();
			isOk = false;

		});
		isOk = false;
	} else if(tinhNoiThuongTru.val() == 0 || quanHuyenNoiThuongTru.val() == 0 || phuongXaNoiThuongTru.val() == 0){
		if (tinhNoiThuongTru.val() == 0){
		showPopupConfirm('<liferay-ui:message key="xin-vui-long-nhap-thong-tin" /> : [<liferay-ui:message key="noi-thuong-tru" />]',['Ok'],function(index){
			tinhNoiThuongTru.focus();
			isOk = false;

		});
		}else if (quanHuyenNoiThuongTru.val() == 0){
			showPopupConfirm('<liferay-ui:message key="xin-vui-long-nhap-thong-tin" /> : [<liferay-ui:message key="noi-thuong-tru" />]',['Ok'],function(index){
				quanHuyenNoiThuongTru.focus();
				isOk = false;

			});
			}
		else {
			showPopupConfirm('<liferay-ui:message key="xin-vui-long-nhap-thong-tin" /> : [<liferay-ui:message key="noi-thuong-tru" />]',['Ok'],function(index){
				phuongXaNoiThuongTru.focus();
				isOk = false;

			});
			}
		isOk = false;
	}
	else{
		var inputList = $(".mandatory");		
		if (inputList.length > 0){
			for (var i = 0;i<inputList.length;i++){
				var firstItem = inputList.eq(i);
				if (firstItem.val() == ''){
					var messageName = firstItem.attr('message').toString();
					showPopupConfirm('<liferay-ui:message key="xin-vui-long-nhap-thong-tin" />  : ['+messageName+']',['Ok'],function(index){
						$(firstItem).focus();
						isOk = false;
						return;
					});
					isOk = false;
					break;
				}
			}	
		}
		
	}
	if (isOk){
		var soCMND = $('#<portlet:namespace />soCMNDDoiTuongTrichLuc').val();
		if(soCMND != '' && !validateCMND(soCMND)) {
			showPopupConfirm('<liferay-ui:message key="so-cmnd-nay-khong-hop-le" />',['Ok'],function(index){
				$("#<portlet:namespace/>soCMNDDoiTuongTrichLuc").focus();
			});
			isOk = false;
		}	
	}
	return isOk;
	
}
function <portlet:namespace/>luuYeuCauTrichLuc(){
	if(<portlet:namespace/>validationForm()){
		showPopupConfirm('<liferay-ui:message key="ban-co-muon-luu-thong-tin" />',['Yes','No'],function(index){
			if (index == 0){
				$("#<portlet:namespace/>fm").submit();
			}
		});	
	} 
}
</script>


<form id="<portlet:namespace />fm" name="<portlet:namespace />fm" action="<%=capNhatYeuCauTrichLucTienAnActionURL.toString() %>" method="post">
	<table class="gridnormal">
		<tr>
			<td class="aui-w20"><liferay-ui:message key="ma-yeu-cau-trich-luc" />&nbsp;<font color="red">*</font></td>
			<td class="aui-w30">
				<input type="text" required id="<portlet:namespace/>maYeuCauTrichLuc" name="<portlet:namespace/>maYeuCauTrichLuc" style="width: 50%" readonly="readonly" value="<%=maYeuCauTrichLuc%>">
				<c:if test='<%= mode.equalsIgnoreCase("add") %>'>
				<input type="button" class="btn" id="<portlet:namespace/>layMaYeuCauTrichLuc" value="<liferay-ui:message key="lay-so" />" onclick="layMa();"/>
				</c:if>
			</td>
			<td class="aui-w20"></td>
			<td class="aui-w30"></td>
		</tr>
		
		<tr>
			<td><liferay-ui:message key="kinh-gui" />&nbsp;<font color="red">*</font></td>
			<td colspan="3"><input type="text"  class="mandatory" message="<liferay-ui:message key='kinh-gui' />"   style="width: 97%" name="<portlet:namespace />kinhGui" id="<portlet:namespace />kinhGui" value="<%=kinhGui%>" /></td>
		</tr>

		<tr>
			<td><liferay-ui:message key="ho-va-ten" />&nbsp;<font color="red">*</font></td>
			<td><input type="text" name="<portlet:namespace />hoVaTenDoiTuongTrichLuc"  class="mandatory" message="<liferay-ui:message key='ho-va-ten' />"  id="<portlet:namespace />hoVaTenDoiTuongTrichLuc" value="<%=hoVaTenDoiTuongTrichLuc%>" /></td>
			<td><liferay-ui:message key="ho-va-ten-khac" /></td>
			<td><input type="text" name="<portlet:namespace />hoVaTenGoiKhac" id="<portlet:namespace />hoVaTenGoiKhac" value="<%=hoVaTenGoiKhac%>" /></td>
		</tr>

		<tr>
			<td><liferay-ui:message key="gioi-tinh"/>&nbsp;<font color="red">*</font></td>
			<td>
				<%
					EnumGioiTinh [] gioiTinhs = EnumGioiTinh.values();
				%>
				<select class="mandatory" message="<liferay-ui:message key='gioi-tinh' />"  name="<portlet:namespace />gioiTinh" id="<portlet:namespace />gioiTinh" >
					<%
						for(EnumGioiTinh e : gioiTinhs) {
					%>
					
					<option value=<%=e.getValue() %> <%= (e.getValue() == gioiTinh) ? "selected = 'true'" : ""%>><liferay-ui:message key="<%=e.getKey() %>" /></option> 
					
					<%
						}
					%>
				</select>
			</td>
			<td><liferay-ui:message key="ngay-sinh" />&nbsp;<font color="red">*</font></td>
			<td class="ip-datepicker"><input type="text"  class="mandatory" message="<liferay-ui:message key='ngay-sinh' />"  style="width: 90%" name="<portlet:namespace />ngaySinhDoiTuongTrichLuc" id="<portlet:namespace />ngaySinhDoiTuongTrichLuc" value="<%=Validator.isNotNull(ngaySinhDoiTuongTrichLuc) ? sdf.format(ngaySinhDoiTuongTrichLuc) : "" %>" /></td>
		</tr>
		
		<tr>
			<td><liferay-ui:message key="noi-sinh" /></td>
			<td colspan="2">
				<select class="display-inline" style="width: 30%" name="<portlet:namespace/>noiSinhTinhId" id="<portlet:namespace/>noiSinhTinhId" onchange="loadQuanHuyen('<portlet:namespace/>noiSinhTinhId', '<portlet:namespace/>noiSinhQuanHuyenId', '<portlet:namespace />noiSinhPhuongXaId', '<%=loadQuanHuyen.toString()%>','<%=noiSinhQuanHuyenId%>');">
					<option value="0" label="<liferay-ui:message key="chon-tinh"/>"></option>
					<%
						List<Tinh> tinhs = TinhLocalServiceUtil.findAll();
						for (Tinh tinh : tinhs) {
					%>
					<option value="<%=tinh.getTinhId()%>" <%=(tinh.getTinhId() == noiSinhTinhId || tinh.getLaMacDinh()) ? "selected=selected"
						: StringPool.BLANK%>><%=tinh.getTenTinh() %></option>
					<%
					}
					%>
				</select>
				
				<select class="display-inline" style="width: 30%" name="<portlet:namespace/>noiSinhQuanHuyenId" id="<portlet:namespace/>noiSinhQuanHuyenId" onchange="loadPhuongXa('<portlet:namespace/>noiSinhQuanHuyenId', '<portlet:namespace/>noiSinhPhuongXaId', '<%=loadPhuongXa.toString() %>', '<%=noiSinhPhuongXaId %>');">
					<option value="0" label="<liferay-ui:message key="chon-quan-huyen"/>"></option>
				</select>
				<select class="display-inline" style="width: 37%" name="<portlet:namespace/>noiSinhPhuongXaId" id="<portlet:namespace/>noiSinhPhuongXaId">
					<option value="0" label="<liferay-ui:message key="chon-phuong-xa"/>"></option>
				</select></td>
			<td><input type="text" name="<portlet:namespace/>noiSinh" id="<portlet:namespace/>noiSinh" value="<%=noiSinh %>" /></td>
		</tr>
		
		<tr>
			<td><liferay-ui:message key="quoc-tich" />&nbsp;<font color="red">*</font></td>
			<td>
			<%
			
			EnumQuocTich[] quocTichs = EnumQuocTich.values();
			%>
			<select  name="<portlet:namespace />quocTich" id="<portlet:namespace />quocTich" class="mandatory" message="<liferay-ui:message key='quoc-tich' />"> 
			<%
				for(EnumQuocTich d : quocTichs) {
					String quocTichText = LanguageUtil.get(pageContext, d.getKey());
			%>
				<option value="<liferay-ui:message key='<%=d.getKey() %>' />" <%= (quocTichText.equals(quocTich) || d.getValue() == 1) ? "selected = 'true'" : ""%>><liferay-ui:message key="<%=d.getKey() %>" /></option>
			<%
				}
			%>
			</select>
			</td>
			<td><liferay-ui:message key="dan-toc" />&nbsp;<font color="red">*</font></td>
			<td>
			<%
					List<DanToc>  danTocs = DanTocLocalServiceUtil.findAll();
				%>
				
				<select  class="mandatory" message="<liferay-ui:message key='dan-toc' />"  name="<portlet:namespace />danTocId" id="<portlet:namespace />danTocId">
					<option value="0" ><liferay-ui:message key="chon-dan-toc"/></option>
					<%
						for(DanToc d : danTocs) {
					%>
					<option value=<%=d.getDanTocId() %> <%= (d.getDanTocId() == danTocId || d.getDanTocId() == DanTocEnum.KINH.getIdDanToc()) ? "selected = 'true'" : ""%>><%= d.getTenDanToc() %></option>
					<%
						}
					%>
				</select>
			</td>
		</tr>
		
		<tr>
			<td><liferay-ui:message key="noi-thuong-tru" />&nbsp;<font color="red">*</font></td>

			<td colspan="2">
				<select class="display-inline" style="width: 30%" name="<portlet:namespace/>noiThuongTruDoiTuongTrichLucTinhId" id="<portlet:namespace/>noiThuongTruDoiTuongTrichLucTinhId" onchange="loadQuanHuyen('<portlet:namespace />noiThuongTruDoiTuongTrichLucTinhId', '<portlet:namespace />noiThuongTruDoiTuongTrichLucQuanHuyenId', '<portlet:namespace />noiThuongTruDoiTuongTrichLucPhuongXaId', '<%=loadQuanHuyen.toString()%>','<%=noiThuongTruDoiTuongTrichLucQuanHuyenId%>');">
					<option value="0" label="<liferay-ui:message key="chon-tinh"/>"></option>
					<%
					for (Tinh tinh : tinhs) {
					%>
					<option value="<%=tinh.getTinhId()%>" <%=(tinh.getTinhId() == noiThuongTruDoiTuongTrichLucTinhId || tinh.isLaMacDinh()) ? "selected=selected": StringPool.BLANK%>><%=tinh.getTenTinh() %></option>
					<%
					}
					%>
				</select>
				 <select class="display-inline" style="width: 30%" name="<portlet:namespace/>noiThuongTruDoiTuongTrichLucQuanHuyenId" id="<portlet:namespace/>noiThuongTruDoiTuongTrichLucQuanHuyenId" onchange="loadPhuongXa('<portlet:namespace/>noiThuongTruDoiTuongTrichLucQuanHuyenId', '<portlet:namespace/>noiThuongTruDoiTuongTrichLucPhuongXaId', '<%=loadPhuongXa.toString() %>', '<%=noiThuongTruDoiTuongTrichLucPhuongXaId %>');">
					<option value="0" label="<liferay-ui:message key="chon-quan-huyen"/>"></option>
				</select> 
				<select class="display-inline" style="width: 37%" name="<portlet:namespace/>noiThuongTruDoiTuongTrichLucPhuongXaId" id="<portlet:namespace/>noiThuongTruDoiTuongTrichLucPhuongXaId">
					<option value="0" label="<liferay-ui:message key="chon-phuong-xa"/>"></option>
				</select>
			</td>
			<td><input type="text" class="mandatory" message="<liferay-ui:message key='noi-thuong-tru' />" name="<portlet:namespace/>noiThuongTruDoiTuongTrichLucDiaChi" id="<portlet:namespace/>noiThuongTruDoiTuongTrichLucDiaChi" value="<%=noiThuongTruDoiTuongTrichLucDiaChi %>" /></td>
		</tr>

		<tr>
			<td><liferay-ui:message key="noi-tam-tru" /></td>

			<td colspan="2">
				<select class="display-inline" style="width: 30%" name="<portlet:namespace/>noiTamTruDoiTuongTrichLucTinhId" id="<portlet:namespace/>noiTamTruDoiTuongTrichLucTinhId" onchange="loadQuanHuyen('<portlet:namespace />noiTamTruDoiTuongTrichLucTinhId', '<portlet:namespace />noiTamTruDoiTuongTrichLucQuanHuyenId', '<portlet:namespace />noiTamTruDoiTuongTrichLucPhuongXaId', '<%=loadQuanHuyen.toString()%>','<%=noiTamTruDoiTuongTrichLucQuanHuyenId%>');">
					<option value="0" label="<liferay-ui:message key="chon-tinh"/>"></option>
					<%
					for (Tinh tinh : tinhs) {
					%>
					<option value="<%=tinh.getTinhId()%>" <%=(tinh.getTinhId() == noiTamTruDoiTuongTrichLucTinhId || tinh.isLaMacDinh()) ? "selected=selected" : StringPool.BLANK%>><%=tinh.getTenTinh() %></option>
					<%
					}
					%>
				</select>
				<select class="display-inline" style="width: 30%" name="<portlet:namespace/>noiTamTruDoiTuongTrichLucQuanHuyenId" id="<portlet:namespace/>noiTamTruDoiTuongTrichLucQuanHuyenId" onchange="loadPhuongXa('<portlet:namespace/>noiTamTruDoiTuongTrichLucQuanHuyenId', '<portlet:namespace/>noiTamTruDoiTuongTrichLucPhuongXaId', '<%=loadPhuongXa.toString() %>', '<%=noiTamTruDoiTuongTrichLucPhuongXaId %>');">
					<option value="0" label="<liferay-ui:message key="chon-quan-huyen"/>"></option>
				</select> 
				<select class="display-inline" style="width: 37%" name="<portlet:namespace/>noiTamTruDoiTuongTrichLucPhuongXaId" id="<portlet:namespace/>noiTamTruDoiTuongTrichLucPhuongXaId">
					<option value="0" label="<liferay-ui:message key="chon-phuong-xa"/>"></option>
				</select>
			</td>
			
			<td><input  type="text" name="<portlet:namespace/>noiTamTruDoiTuongTrichLucDiaChi" id="<portlet:namespace/>noiTamTruDoiTuongTrichLucDiaChi" value="<%=noiTamTruDoiTuongTrichLucDiaChi %>" /></td>
		</tr>

		<tr>
			<td><liferay-ui:message key="so-cmnd" /></td>
			<td colspan="3">
			<table>
				<tr>
					<td style="padding:0" >
					<input type="text" name="<portlet:namespace />soCMNDDoiTuongTrichLuc" id="<portlet:namespace />soCMNDDoiTuongTrichLuc" value="<%=soCMNDDoiTuongTrichLuc%>" />
					
					</td>
					<td>
						<liferay-ui:message key="ngay-cap" />
					</td>
					<td style="padding:0"  class="ip-datepicker">
						<input style="width:90%" type="text" name="<portlet:namespace />ngayCapSoCMND" id="<portlet:namespace />ngayCapSoCMND" value="<%=Validator.isNotNull(ngayCapSoCMNDDoiTuongTrichLuc) ? sdf.format(ngayCapSoCMNDDoiTuongTrichLuc) : ""%>" />
					</td>
					<td>
						<liferay-ui:message key="noi-cap" />
					</td>
					<td style="padding:0"  class="ip-datepicker">
						<input style="width:89%" type="text" name="<portlet:namespace />noiCapSoCMND" id="<portlet:namespace />noiCapSoCMND" value="<%=noiCapSoCMNDDoiTuongTrichLuc%>" />
					</td>
				</tr>
			</table>
		</tr>
		
		<tr>
			<td><liferay-ui:message key="so-ho-chieu" /></td>
			<td colspan="3">
			<table>
				<tr>
					<td style="padding:0" >
					<input type="text" name="<portlet:namespace />soHoChieuDoiTuongTrichLuc" id="<portlet:namespace />soHoChieuDoiTuongTrichLuc" value="<%=soHoChieuDoiTuongTrichLuc%>" />
					
					</td>
					<td>
						<liferay-ui:message key="ngay-cap" />
					</td>
					<td style="padding:0"  class="ip-datepicker">
						<input style="width:90%" type="text" name="<portlet:namespace />ngayCapSoHoChieu" id="<portlet:namespace />ngayCapSoHoChieu" value="<%=Validator.isNotNull(ngayCapSoHoChieuDoiTuongTrichLuc) ? sdf.format(ngayCapSoHoChieuDoiTuongTrichLuc) : ""%>" />
					</td>
					<td >
						<liferay-ui:message key="noi-cap" />
					</td>
					<td style="padding:0"  class="ip-datepicker">
						<input style="width:89%" type="text" name="<portlet:namespace />noiCapSoHoChieu" id="<portlet:namespace />noiCapSoHoCHieu" value="<%=noiCapSoHoChieuDoiTuongTrichLuc%>" />
					</td>
				</tr>
			</table>
		</tr>
		
		<tr>
			<td><liferay-ui:message key="ho-va-ten-cha" /></td>
			<td><input type="text" name="<portlet:namespace/>hoTenCha" id="<portlet:namespace/>hoTenCha" value="<%=hoVaTenCha%>" /></td>
			<td><liferay-ui:message key="ho-va-ten-me" /></td>
			<td><input type="text" name="<portlet:namespace/>hoVaTenMe" id="<portlet:namespace/>hoTenCha" value="<%=hoVaTenMe%>" /></td>
		</tr>
		
		<tr>
			<td><liferay-ui:message key="ten-vo-hoac-chong" /></td>
			<td><input type="text" name="<portlet:namespace/>hoTenVoHoacChong" id="<portlet:namespace/>hoTenVoHoacChong" value="<%=hoTenVoHoacChong%>" /></td>
			<td><liferay-ui:message key="so-dinh-danh-ca-nhan" /></td>
			<td><input type="text" name="<portlet:namespace/>soDinhDanhCaNhanDoiTuongTrichLuc" id="<portlet:namespace/>soDinhDanhCaNhanDoiTuongTrichLuc" value="<%=soDinhDanhCaNhan%>" /></td>
		</tr>
		
		<tr>
			<td class="txtlabel aui-w20"><liferay-ui:message key="ho-va-ten-nguoi-yeu-cau-trich-luc" />&nbsp;<font color="red">*</font></td>
			<td class="aui-w30">
				<input type="text"  class="mandatory" message="<liferay-ui:message key='ho-va-ten-nguoi-yeu-cau-trich-luc' />"  name="<portlet:namespace />hoVaTenNguoiYeuCauTrichLuc" id="<portlet:namespace />hoVaTenNguoiYeuCauTrichLuc" value="<%=hoVaTenNguoiYeuCauTrichLuc %>" />
			</td>
			<td><liferay-ui:message key="ngay-de-nghi-tra-trich-luc" />&nbsp;<font color="red">*</font></td>
			<td class="ip-datepicker"><input type="text" style="width: 90%"  class="mandatory" message="<liferay-ui:message key='ngay-de-nghi-tra-trich-luc' />"  name="<portlet:namespace />ngayDeNghiTraTrichLuc" id="<portlet:namespace />ngayDeNghiTraTrichLuc" value="<%=Validator.isNotNull(ngayDeNghiTraTrichLuc) ? sdf.format(ngayDeNghiTraTrichLuc) : "" %>" /></td>
		</tr>

		<tr>
			<td><liferay-ui:message key="ngay-lap-trich-luc" />&nbsp;<font color="red">*</font></td>
			<td class="ip-datepicker">
				<input type="text"   class="mandatory" message="<liferay-ui:message key='ngay-lap-trich-luc' />" style="width: 90%" name="<portlet:namespace />ngayLapTrichLuc" id="<portlet:namespace />ngayLapTrichLuc" value="<%=Validator.isNotNull(ngayLapTrichLuc) ? new SimpleDateFormat(TienAnConstants.DATE_PATTERN).format(ngayLapTrichLuc) :new SimpleDateFormat(TienAnConstants.DATE_PATTERN).format(new Date())%>" />
			</td>
			<td><liferay-ui:message key="co-quan-yeu-cau" />&nbsp;<font color="red">*</font></td>
			<td>
				<input type="text"   class="mandatory" message="<liferay-ui:message key='co-quan-yeu-cau' />" name="<portlet:namespace />coQuanYeuCau" id="<portlet:namespace />coQuanYeuCau" value="<%=coQuanYeuCau%>" />
			</td>
		</tr>
		
		<tr>
			<td><liferay-ui:message key="chu-thich" /></td>
			<td colspan="3">
				<textarea style="width:97%" name="<portlet:namespace />chuThich"><%=chuThich %></textarea>
			</td>
		</tr>
		
		<tr>
			<td/></td>
			<td colspan="3">
				<div align="left">
					<input type="button" onclick="<portlet:namespace/>luuYeuCauTrichLuc()" class="btn btn-primary" value="<liferay-ui:message key="luu" />"/>
					<input type="button" onclick="javascript:submitForm(document.hrefFm,'<%=redirect %>');" class="btn" value="<liferay-ui:message key="tro-ve" />" />
				</div>
			</td>
		</tr>
	</table>
</form>